<%-- 
    Document   : userList
    Created on : Oct 17, 2012, 9:03:08 PM
    Author     : DinhThang
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Users List</title>
            <link rel="stylesheet" type="text/css" href="../styles/style.css" />
        </head>
        <body>        
            <jsp:include page="../includes/incHeader.jsp" flush="false" />
            <h3>Users List</h3>
            <h:form>
                <center>
                <h:commandLink value="Add New" action="userAddNew"/></center><br/>
                <h:messages/>
                <h:dataTable style="margin:0 auto; border:1px solid #999; width:60%" value="#{usersBean.usersList}" var="user" rendered="#{not empty usersBean.usersList}">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Role Name"/>
                        </f:facet>
                        <h:outputText value="#{user.roleName}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Department Name"/>
                        </f:facet>
                        <h:outputText value="#{user.departmentName}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="User Name"/>
                        </f:facet>
                        <h:outputText value="#{user.username}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Password"/>
                        </f:facet>
                        <h:outputText value="#{user.password}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="First Name"/>
                        </f:facet>
                        <h:outputText value="#{user.firstName}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Last Name"/>
                        </f:facet>
                        <h:outputText value="#{user.lastName}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="IsEnable"/>
                        </f:facet>
                        <h:outputText value="#{user.isEnable}"/>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Delete"/>
                        </f:facet>
                        <h:commandLink value="Del" action="#{usersBean.prepareData4Delete}">
                            <f:param name="idParam" value="#{user.userID}"/>
                        </h:commandLink>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Update"/>
                        </f:facet>
                        <h:commandLink value="Edit" action="#{usersBean.prepareData4Update}">
                            <f:param name="idParam" value="#{user.userID}"/>
                        </h:commandLink>
                    </h:column>
                </h:dataTable>
            </h:form>

<jsp:include page="../includes/incFooter.jsp" flush="false" />
        </body>
    </html>
</f:view>
